import 'package:myturngame/facotry/suit_factory.dart';

import '../bean/bagobject/bag_object.dart';
import '../bean/bagobject/equipment.dart';
import '../bean/function/normal_equip_function.dart';
import '../bean/function/skill001_equip_function.dart';
import '../bean/role.dart';
import '../colors.dart';

///生成一件装备
Equipment createEquipment(String name) {
  if (name == "equip001") {
    return Equipment(name, Equipment.typeWeapon, "普通木剑", objectFunctions: [
      NormalEquipFunction(AttributeSet.startAttack, 1),
      NormalEquipFunction(AttributeSet.criticalRate, 10),
    ]);
  } else if (name == "equip002") {
    return Equipment(name, Equipment.typeHat, "普通草帽", objectFunctions: [
      NormalEquipFunction(AttributeSet.startMaxHp, 10),
    ]);
  } else if (name == "equip003") {
    return Equipment(name, Equipment.typeClothe, "普通布衣", objectFunctions: [
      NormalEquipFunction(AttributeSet.startDefend, 2),
    ]);
  } else if (name == "equip004") {
    return Equipment(name, Equipment.typeShoe, "普通草鞋", objectFunctions: [
      NormalEquipFunction(AttributeSet.startSpeed, 10),
    ]);
  } else if (name == "equip005") {
    return createSkill001Suit1();
  } else if (name == "equip006") {
    return createSkill001Suit2();
  } else if (name == "equip007") {
    return createSkill001Suit3();
  } else if (name == "equip008") {
    return createSkill001Suit4();
  } else if (name == "equip009") {
    return createSkill002Suit1();
  } else if (name == "equip010") {
    return createSkill002Suit2();
  } else if (name == "equip011") {
    return createSkill002Suit3();
  } else if (name == "equip012") {
    return createSkill002Suit4();
  } else if (name == "equip013") {
    return Equipment(name, Equipment.typeWeapon, "毁天灭地",
        objectFunctions:
            List.generate(AttributeSet.typeCount - 6, (index) => index + 6)
                .map((e) => NormalEquipFunction(e, 999))
                .toList());
  } else {
    return Equipment(name, Equipment.typeWeapon, "");
  }
}

///横扫套装
Equipment createSkill001Suit1() {
  return Equipment("横扫头", Equipment.typeHat, "横扫套装头部", objectFunctions: [
    NormalEquipFunction(AttributeSet.pointIndexHealth, 10),
    NormalEquipFunction(AttributeSet.startAttack, 1),
    Skill001EquipFunction(2),
  ])
    ..color = suit001Color
    ..suit = createSuit001();
}

Equipment createSkill001Suit2() {
  return Equipment("横扫甲", Equipment.typeClothe, "横扫套装身体", objectFunctions: [
    NormalEquipFunction(AttributeSet.startDefend, 2),
    Skill001EquipFunction(1),
  ])
    ..color = suit001Color
    ..suit = createSuit001();
}

Equipment createSkill001Suit3() {
  return Equipment("横扫鞋", Equipment.typeShoe, "横扫套装鞋子", objectFunctions: [
    NormalEquipFunction(AttributeSet.startSpeed, 5),
    Skill001EquipFunction(2),
  ])
    ..color = suit001Color
    ..suit = createSuit001();
}

Equipment createSkill001Suit4() {
  return Equipment("横扫剑", Equipment.typeWeapon, "横扫套装武器", objectFunctions: [
    NormalEquipFunction(AttributeSet.startAttack, 10),
    NormalEquipFunction(AttributeSet.pointIndexPower, 2),
    Skill001EquipFunction(5),
  ])
    ..color = suit001Color
    ..suit = createSuit001();
}

///猛击套装
Equipment createSkill002Suit1() {
  return Equipment("猛击头", Equipment.typeHat, "猛击套装头部", objectFunctions: [
    Skill002EquipFunction(10),
  ])
    ..color = suit002Color
    ..suit = createSuit002();
}

Equipment createSkill002Suit2() {
  return Equipment("猛击甲", Equipment.typeClothe, "猛击套装身体", objectFunctions: [
    Skill002EquipFunction(30),
  ])
    ..color = suit002Color
    ..suit = createSuit002();
}

Equipment createSkill002Suit3() {
  return Equipment("猛击鞋", Equipment.typeShoe, "猛击套装鞋子", objectFunctions: [
    Skill002EquipFunction(20),
  ])
    ..color = suit002Color
    ..suit = createSuit002();
}

Equipment createSkill002Suit4() {
  return Equipment("猛击剑", Equipment.typeWeapon, "猛击套装武器", objectFunctions: [
    Skill002EquipFunction(40),
  ])
    ..color = suit002Color
    ..suit = createSuit002();
}
